home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 125 / Computer Shopper CD-ROM Issue 125 (1998-07)(Dennis Publishing).iso / Business / Dazzler / DAZZLER.Z / CDrawPoly.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-11-26  |  1.8 KB  |  64 lines

  1. import java.awt.Graphics;
  2. import java.awt.Point;
  3. import java.awt.Rectangle;
  4.  
  5. class CDrawPoly extends CDrawObj {
  6.    protected CPolyline m_polyActual;
  7.    protected CPolyline m_polyDraw;
  8.  
  9.    void Render(Graphics var1, CRect var2, int var3) {
  10.       if (((Rectangle)var2).intersects(((CDrawObj)this).GetDrawRect())) {
  11.          CPolyline var4 = new CPolyline(this.m_polyDraw.xpoints, this.m_polyDraw.ypoints, this.m_polyDraw.npoints);
  12.          super.m_pIconObject.DrawObject(var1, var3, var4);
  13.       }
  14.  
  15.    }
  16.  
  17.    boolean HitTest(Point var1) {
  18.       CPolyline var2 = new CPolyline(this.m_polyDraw.xpoints, this.m_polyDraw.ypoints, this.m_polyDraw.npoints);
  19.       return ((CDrawObj)this).GetDrawRect().inside(var1.x, var1.y) && super.m_pIconObject.HitTestCheck(var1, var2);
  20.    }
  21.  
  22.    CDrawPoly(CIconObject var1, int var2) {
  23.       super(var1, var2);
  24.       CPolyline var3 = var1.GetActualPolyline();
  25.       this.m_polyActual = new CPolyline(var3.xpoints, var3.ypoints, var3.npoints);
  26.       this.m_polyDraw = new CPolyline(this.m_polyActual.xpoints, this.m_polyActual.ypoints, this.m_polyActual.npoints);
  27.    }
  28.  
  29.    void SetFixed() {
  30.       super.m_nFlags &= -257;
  31.       super.m_pSetBy = null;
  32.    }
  33.  
  34.    void MoveTo(Point var1, boolean var2, boolean var3) {
  35.       CRect var4 = new CRect(((CDrawObj)this).GetDrawRect());
  36.       CRect var5 = new CRect(var1.x, var1.y, var4.width, var4.height);
  37.       if (!var3) {
  38.          var5.x -= var4.width / 2;
  39.          var5.y -= var4.height / 2;
  40.       }
  41.  
  42.       if (!((Rectangle)var5).equals(var4)) {
  43.          this.m_polyDraw.MoveBy(var5.x - var4.x, var5.y - var4.y);
  44.          ((CDrawObj)this).SetDrawRect(var5);
  45.          var2 = true;
  46.       }
  47.  
  48.       if (var2) {
  49.          if (((Rectangle)var4).intersects(var5)) {
  50.             var4 = var4.union(var5);
  51.             Globals.thePresView.Render(var4);
  52.             Globals.thePresView.Draw((Graphics)null, var4);
  53.             return;
  54.          }
  55.  
  56.          Globals.thePresView.Render(var4);
  57.          Globals.thePresView.Draw((Graphics)null, var4);
  58.          Globals.thePresView.Render(var5);
  59.          Globals.thePresView.Draw((Graphics)null, var5);
  60.       }
  61.  
  62.    }
  63. }
  64.